package me.zhengjie.modules.base;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

@Data
public class BasePage {

    private Page<Object> page;

    public BasePage() {
        this.page = new Page<>(1, 10);
    }

    public Page<Object> getPage() {
        return page;
    }

    public void setPage(Page<Object> page) {
        this.page = page;
    }

    public Integer getCurrentPage() {
        return Math.toIntExact(this.page.getCurrent());
    }

    public Integer getPageSize() {
        return Math.toIntExact(this.page.getSize());
    }

    public void setCurrentPage(Integer currentPage) {
        this.page.setCurrent(currentPage);
    }

    public void setPageSize(Integer pageSize) {
        this.page.setSize(pageSize);
    }
}